/*
  License...
*/

#ifndef _CORE_MORPHOLOGY_H_
#define _CORE_MORPHOLOGY_H_

#include "../third_party/bitmap.h"
#include "../common/typedefs.h"

struct CPoint
{
	ulong x;
	ulong y;
};

struct CImg
{
	ulong width, height, size;
	pixel_type* buff;
};

void InitImg(char* FileName, CImg* outimg);
void DestroyImg(CImg* img);

struct CPattern:
	public CImg
{
	CPoint* ind1;
	CPoint* ind2;
	ulong len1, len2;
};

void InitPattern(char* FileName, CPattern* outimg);
void DestroyPattern(CPattern* pattern);



struct CFindRes
{
	ulong numres, buffsize;
	double* res_dist;
	CPoint* res_pos;
};

void InitFindRes(CFindRes* fres,ulong size);
void DestroyFindRes(CFindRes* fres);

void Find(CImg* where_img, CPattern* what_img, double lowbound, CFindRes* res);
void Find2(CImg* where_img, CPattern* what_img, ulong num_where_img, double lowbound, CFindRes* res);


#endif